/*
 * @Description: 状态结果枚举
 * @Author: xinqiao lxq1990.0716@qq.com
 * @Date: 2023-10-17
 * @LastEditors: xinqiao lxq1990.0716@qq.com
 * @LastEditTime: 2024-05-10
 */

export enum STATUS_DETECTION_ENUM {
  /** 检测须知 */
  INSTRUCTION = 0,
  /** 待填写问卷 */
  QUESTIONNAIRE = 10,
  /** 位置待确认 */
  POSITION = 20,
  /** 样本待收集 */
  COLLECT_SAMPLES = 30,
  /** 快递待取件 */
  EXPRESS = 40,
  /** 等待检测报告 */
  TEST_REPORT = 50,
}
export enum SCAN_TYPE {
  /** 菌群检测扫描二维码 */
  SCAN_DETECTION = 1,
  /** 供体招募扫描二维码 */
  SCAN_RECRUIT = 2,
  /** 产品溯源 */
  SCAN_PRODUCT = 3,
}
export const scanTypeDesc: any = {
  [SCAN_TYPE.SCAN_DETECTION]: '肠道菌群检测',
  [SCAN_TYPE.SCAN_RECRUIT]: '供体招募',
}
export const stepNoDescEnum: any = {
  [SCAN_TYPE.SCAN_DETECTION]: 3,
  [SCAN_TYPE.SCAN_RECRUIT]: 2,
}
export const stepNoDesc: any = {
  [SCAN_TYPE.SCAN_DETECTION]: '检测',
  [SCAN_TYPE.SCAN_RECRUIT]: '招募',
}
export const scanResultLink: Record<SCAN_TYPE, any> = {
  [SCAN_TYPE.SCAN_DETECTION]: {
    [STATUS_DETECTION_ENUM.INSTRUCTION]: '/pages/detection/index',
    [STATUS_DETECTION_ENUM.QUESTIONNAIRE]: '/pages/detection/questionnaire',
    [STATUS_DETECTION_ENUM.POSITION]: '/pages/detection/position',
    [STATUS_DETECTION_ENUM.COLLECT_SAMPLES]: '/pages/detection/collectSamples',
    [STATUS_DETECTION_ENUM.EXPRESS]: '/pages/detection/express',
    [STATUS_DETECTION_ENUM.TEST_REPORT]: '/pages/detection/testReport',
  },
  [SCAN_TYPE.SCAN_RECRUIT]: {
    [STATUS_DETECTION_ENUM.INSTRUCTION]: '/pages/recruit/recruitNotice',
    [STATUS_DETECTION_ENUM.QUESTIONNAIRE]: '/pages/detection/questionnaire',
    [STATUS_DETECTION_ENUM.POSITION]: '/pages/detection/position',
  },
}
export const scanTypeResult: Record<SCAN_TYPE, any> = {
  [SCAN_TYPE.SCAN_DETECTION]: {
    title: '样本待收集',
    content: '请根据视频提示收集检测样本',
    btn: '样本收集',
    handle: (resData: any) => {
      if (!resData.detectionInfoId) {
        uni.showToast({ title: 'detectionInfoId为空', icon: 'none' })
        return
      }
      uni.navigateTo({
        url: `/pages/detection/collectSamples?detectionInfoId=${resData.detectionInfoId}`,
      })
    },
  },
  [SCAN_TYPE.SCAN_RECRUIT]: {
    title: '待电话回访',
    content: '请耐心等待回访电话',
    btn: '查看问卷',
    handle: (resData: any) => {
      if (resData.scanFlag) {
        uni.showToast({ title: '请耐心等待回放电话', icon: 'none' })
        return
      }
      uni.navigateTo({
        url: `/pages/detection/preview?publishId=${resData.publishId}&recordID=${resData.questionnaireRecordId}`,
      })
    },
  },
}
